package com.softer.wxzj.controller;


import com.softer.wxzj.entity.FlowAuditdetail;
import com.softer.wxzj.entity.FlowInstance;
import com.softer.wxzj.service.FlowAuditdetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * FlowAuditdetailController class
 * @author zcz
 * @date 2019/1/16
 */
@RestController
@RequestMapping("/flowAuditdetail")
@Slf4j
public class FlowAuditdetailController {
    @Autowired
    FlowAuditdetailService flowAuditdetailService;

    /**
     * 根据业务id和类型查询审批意见
     * @param businessId
     * @param flowType
     * @return
     */
    @RequestMapping("/getAuditdetailList")
    public List<FlowAuditdetail> getAuditdetailList(@RequestParam("businessId") String businessId, @RequestParam("flowType")String flowType) {
        return flowAuditdetailService.getAuditdetailList(businessId, flowType);
    }

    /**
     * 根据业务id和类型查询当前的审批意见
     * @param businessId
     * @param flowType
     * @return
     */
    @RequestMapping("/getCurrentAuditdetailList")
    public List<FlowAuditdetail> getCurrentAuditdetailList(@RequestParam("businessId") String businessId, @RequestParam("flowType")String flowType) {
        return flowAuditdetailService.getCurrentAuditdetailList(businessId, flowType);
    }

    /**
     * 根据业务id和类型查询所有审批意见
     * @param businessId
     * @param flowType
     * @param id
     * @return
     */
    @RequestMapping("/getHistoryList")
    public List<FlowInstance> getHistoryList(@RequestParam("businessId") String businessId, @RequestParam("flowType")String flowType,String id) {
        return flowAuditdetailService.getHistoryList(businessId, flowType,id);
    }
}
